package org.yx.service.sbas.view_client_roster;

import org.dbist.dml.Page;
import org.dbist.dml.Query;
import org.yx.models.SbasCusDef;
import org.yx.utils.BaseService;

import com.xiaoleilu.hutool.util.StrUtil;

/**
 * 查询客户信息
 * @author zxw
 * @since 2018/03/27
**/
public class SbasViewClientRosterService extends BaseService {
	public SbasViewClientRosterOut viewClientRoster(SbasViewClientRosterIn in) throws Exception {
		Query query = new Query(in.getPageIndex(), in.getPageSize());
		query.addFilter("orgCode", in.getUserOrgCode());
		query.addFilter("status", "<>", 'D');
		if (!StrUtil.isBlank(in.getClientCode())) {
			query.addFilter("clientCode", "like", in.getClientCode() + "%");
		}

		Page<SbasCusDef> clientPage = selectPage(SbasCusDef.class, query);

		SbasViewClientRosterOut out = new SbasViewClientRosterOut();
		out.setTotalSize(clientPage.getTotalSize());
		out.setClientList(clientPage.getList());

		return out;
	}
}